package net.towee.model.account;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * Role of user in some group. It contains set of 
 * permissions that have any user with this role
 * @author  c58
 */
public interface Role extends IsSerializable  {
	
	/**
	 * @return  name of the role
	 */
	String getName();
	
	/**
	 * Set new role name
	 */
	void setName(String name);
	
	/**
	 * @param perm set of permissions
	 * @return true, if role contain ALL permissions in the set, false otherwise
	 */
	boolean hasPermissions(AccountPermission... perm);
	
	/**
	 * Add new permission to the role
	 * @param perm
	 */
	void addPermission(AccountPermission perm);
	
	/**
	 * Remove permission of the role
	 * @param perm
	 */
	void removePremission(AccountPermission perm);

	/**
	 * Id of role
	 * @return
	 */
	String getId();
	
	/**
	 * @return true if this role for owners
	 */
	boolean isOwner();

	/**
	 * Set id of role
	 * @param id
	 */
	void setId(String string);
}